package com.team5101.utils;

import java.util.Date;
import java.util.Random;

/*生成一个编号类*/
public class CreateCodeUtil {
          /*生成一个几乎不重复的唯一编号*/
         public static String  CreateOrderCode(){
                  /*先创建new出一个对象*/
                  Date time  = new Date();
                  /*获取当前的时间的毫秒值*/
                  long times = time.getTime();
                  /*定义一个数据有着26个小写字母的字符数组*/
                  char[]  arr = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
                  /*定义出code码*/
                  String code = "";
                  /*循环出五个数*/
                   for (int i = 0;i< 7;i++){
                       /*先new出一个随机对象*/
                       Random random = new Random();
                        int r = random.nextInt(25);
                       /*根据随机对象便利出来的值*/
                       code = code + arr[r];
                   }
                   /*最后直接返回数据值*/
                   return times+code;
         }
}
